package com.lcw.lostandfound.controller.backstage;

import com.lcw.lostandfound.service.ThankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class AThankController {
    @Autowired
    private ThankService thankService;

    @RequestMapping("/backstage/thanks")
    public String goods(Model model, @RequestParam(name = "pageNum",required = false,defaultValue = "1")Integer pageNum, @RequestParam(name = "pageSize",required = false,defaultValue = "10")Integer pageSize){
        model.addAttribute("thanks",thankService.listThanks(pageNum,pageSize));
        return "admin/thank";
    }
    @ResponseBody
    @RequestMapping("/deleteThank")
    public String deleteGoods(Integer id){
        if (thankService.deleteById(id)>0) {
            return "true";
        }
        return "false";
    }
}
